package com.kang.controller.feign;

import com.kang.feign.AdminFeign;
import com.kang.util.WebResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "调用管理端数据展示")
@RequestMapping("/user/show")
@Slf4j
public class ShowFeignController {

    @Autowired
    private AdminFeign showFeign;

    @ApiOperation("轮播图")
    @GetMapping("getFolderShow")
    public WebResponse getFolderShow() {
        try {
            return WebResponse.resSuccess("获取轮播图数据成功",showFeign.getFolderShow());
        } catch (Exception ex) {
            log.error("获取轮播图数据错误",ex);
            return WebResponse.resFail("获取轮播图数据错误",null);
        }
    }

    @ApiOperation("公告")
    @GetMapping("getNotifyShow")
    public WebResponse getNotifyShow() {
        try {
            return WebResponse.resSuccess("获取公告数据成功",showFeign.getNotifyShow());
        } catch (Exception ex) {
            log.error("获取公告数据错误",ex);
            return WebResponse.resFail("获取公告数据错误",null);
        }
    }

    @ApiOperation("公告")
    @GetMapping("getNotifyById")
    public WebResponse getNotifyById(Integer id) {
        try {
            return WebResponse.resSuccess("获取公告数据成功",showFeign.getNotifyById(id));
        } catch (Exception ex) {
            log.error("获取公告数据错误",ex);
            return WebResponse.resFail("获取公告数据错误",null);
        }
    }




}
